package com.wzy.vx.Utils;

import com.wzy.vx.enums.CodeEnum;

/**
 * @ProjectName: vx
 * @Package: com.wzy.vx.Utils
 * @ClassName: EnumUtil
 * @Author: Administrator
 * @Description: ${description}
 * @Date: 2019/3/18 15:09
 * @Version: 1.0
 */
public class EnumUtil {
    public  static  <T extends CodeEnum> T getByCode(Integer code,Class<T> enumClass){
        for (T each:enumClass.getEnumConstants()) {
            if (code.equals(each.getCode())){
                return each;
            }
        }
        return null;
    }
}
